﻿//  https://www.luogu.com.cn/problem/P10483

#include <iostream>
#include <algorithm>
using namespace std;
const int N = 20;
int n, w;
int c[N]; // ⼩猫的信息
int cnt; // 当前⽤了多少⻋
int s[N]; // 每⼀辆⻋⽬前的总重
int ret = N; // 最优解

bool cmp(int x, int y)
{
    return x > y;
}
void dfs(int pos)
{
    if (cnt >= ret) return;
    if (pos > n)
    {
        ret = cnt;
        return;
    }

    for (int i = 1;i <= cnt;i++)
    {
        if (s[i] + c[pos] > w) continue;
        s[i] += c[pos];
        dfs(pos + 1);
        s[i] -= c[pos];
    }

    cnt++;
    s[cnt] = c[pos];
    dfs(pos + 1);
    s[cnt] -= c[pos];
    cnt--;
}
int main()
{
    cin >> n >> w;
    for (int i = 1;i <= n;i++)
        cin >> c[i];
    sort(c + 1, c + 1 + n, cmp);
    dfs(1);
    cout << ret << endl;
    return 0;
}